package com.eureka.api.controller;

import com.netflix.discovery.converters.Auto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class OrderApiController {

    //使用restTeplate模板，并实现Ribbon负载均衡
    @Autowired
    RestTemplate restTemplate;

    @RequestMapping("/getOrder")
    public String getOrder(){
        String url = "http://app-member/getMember";//url地址，app-member是会员服务的server name
        String result = restTemplate.getForObject(url, String.class);
        return "由订单服务提供："+result;
    }
}
